
<%-------------------------------------------------------------------
 * 页面名称：modifyCryptoKey.jsp
 * 功能描述：密钥设置
 * Action:
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ipb" uri="/WEB-INF/conf/tld/ipb.tld"%>
<%@ taglib prefix="ad" uri="agiledata"%>
<%
String path = request.getContextPath();
%>
<script language="javascript" src="<%=path%>/js/jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/PassGuardCtrl.js"></script>
<SCRIPT LANGUAGE="JavaScript">

var pgeditor = new $.pge({
		pgePath: "./ocx/",//控件文件目录
		pgeId: "_ocx_password",//控件ID
		pgeEdittype: 0,//控件类型,0星号,1明文
		pgeEreg1: "[\\s\\S]*",//输入过程中字符类型限制
		pgeEreg2: "[\\s\\S]{6,32}",	//输入完毕后字符类型判断条件
		pgeMaxlength: 32,//允许最大输入长度
		pgeTabindex:1,//tab键顺序
		pgeClass: "ocx_style",//控件css样式
		pgeInstallClass: "ocx_style",//针对安装或升级
		pgeOnkeydown:"SubmitForm();",//回车键响应函数
	    tabCallback:"_ocx_password"
});

var pgeditor1 = new $.pge({
		pgePath: "./ocx/",//控件文件目录
		pgeId: "_ocx_password1",//控件ID
		pgeEdittype: 0,//控件类型,0星号,1明文
		pgeEreg1: "[\\s\\S]*",//输入过程中字符类型限制
		pgeEreg2: "[\\s\\S]{6,32}",	//输入完毕后字符类型判断条件
		pgeMaxlength: 32,//允许最大输入长度
		pgeTabindex:2,//tab键顺序
		pgeClass: "ocx_style",//控件css样式
		pgeInstallClass: "ocx_style",//针对安装或升级
		pgeOnkeydown:"SubmitForm();",//回车键响应函数
	    tabCallback:"_ocx_password1"
});

var pgeditor2 = new $.pge({
		pgePath: "./ocx/",//控件文件目录
		pgeId: "_ocx_password2",//控件ID
		pgeEdittype: 0,//控件类型,0星号,1明文
		pgeEreg1: "[\\s\\S]*",//输入过程中字符类型限制
		pgeEreg2: "[\\s\\S]{6,32}",	//输入完毕后字符类型判断条件
		pgeMaxlength: 32,//允许最大输入长度
		pgeTabindex:3,//tab键顺序
		pgeClass: "ocx_style",//控件css样式
		pgeInstallClass: "ocx_style",//针对安装或升级
		pgeOnkeydown:"SubmitForm();",//回车键响应函数
	    tabCallback:"_ocx_password2"
});

if(navigator.userAgent.indexOf("MSIE")<0){
	   navigator.plugins.refresh();
}

window.onload = function(){	 
	   pgeditor.pgInitialize();//初始化控件
	   pgeditor1.pgInitialize();
	   pgeditor2.pgInitialize();
}

function get_time(){
	return new Date().getTime();
}

function FormSubmit5(){  
	 $.ajax({
		url: "../../srand_num.jsp?"+get_time(),
		type: "GET",
		async: false,
		success: function(srand_num){
		    pgeditor.pwdSetSk(srand_num);
		    pgeditor1.pwdSetSk(srand_num);
		    pgeditor2.pwdSetSk(srand_num);
		}
	 });
	if(pgeditor.pwdValid()==1){
		alert("原密钥不符合要求");
		 _$("_ocx_password").focus();
		 return false;
	}
	
	if(pgeditor1.pwdLength()==0){
	     alert("新密钥不能为空");
		 _$("_ocx_password1").focus();
		 return false;
	}
	if(pgeditor1.pwdValid()==1){
		alert("新密钥不符合要求");
		 _$("_ocx_password1").focus();
		 return false;
	}
	if(pgeditor2.pwdLength()==0){
		alert("重复新密钥不能为空");
		 _$("_ocx_password2").focus();
		 return false;
	}
	if(pgeditor1.pwdHash()!=pgeditor2.pwdHash()){
	     alert("两次密钥不一致");
		 _$("_ocx_password2").focus();
		 return false;
	}	
	return true;
	//var PwdResult=pgeditor.pwdResult();
	//_$("password").value=PwdResult;//获得密码密文,赋值给表单
}

function submitProcess() {
	
	var formName = document.forms["0"];
	
	//if(checkNecessaryInput(formName)){
		if(FormSubmit5()){
			var PwdResult=pgeditor.pwdResult();
			getObj('oldCryptoKey').value=PwdResult;
			
			var PwdResult1=pgeditor1.pwdResult();
			getObj('newCryptoKey').value=PwdResult1;
			
			var PwdResult2=pgeditor2.pwdResult();
			getObj('reCryptoKey').value=PwdResult2;
			
			formName.submit();
		}
	//}
}
</SCRIPT>
<div id="main">
	<div class="content_right">
		<div style="width:745px;margin-left:10px;">
			<div class="titleinfo">
				密钥设置
			</div>
			<div class="edit_pass">
				<table width="100%" border="0" align="center" cellpadding="7"
										cellspacing="1" bgcolor="#f9e277" style="margin:10px 0;">
										<tr>
											<td bgcolor="#fffdf5">
												<table width="100%" border="0" cellpadding="3"
													cellspacing="0">
													<tr>
														<td width="3%" height="25" valign="top"
															style="border-bottom:1px solid #ccc;"></td>
														<td width="97%" align="left" class="red12b"
															style="border-bottom:1px solid #ccc;">
															特别提醒
														</td>
													</tr>
								<tr>
									<td valign="top">
										&nbsp;
									</td>
									<td align="left" class="font_gray">
										<span class="lan">具有网上支付需求的商户，如电子商务网站，如果使用电子支付平台进行支付，必须设置密钥。</span>
									</td>
								</tr>
								<tr>
									<td valign="top">
										&nbsp;
									</td>
									<td align="left" class="font_gray">
										<span class="lan">密钥是商户与电子支付平台之间进行数据传输时的安全保证。</span>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
				<table width="100%" border="0" align="center" cellpadding="5"
					cellspacing="1">
					<form action="modifyCryptoKey.do" method="post">
						<!-- 原密钥 -->
					<tr>
						<td height="30" align="right">
							原密钥：
						</td>
						<td bgcolor="#FFFFFF">
						    <script type="text/javascript">pgeditor.generate()</script>
							<input type="hidden" id="oldCryptoKey" name="oldCryptoKey" maxlength="32"
								size="25" class="inputStyle" />
							<span class="font_gray">(未设置可为空)</span>
						</td>
					</tr>
					<!--新密钥 -->
					<tr>
						<td width="19%" height="30" align="right">
							<span class="orang12b">*</span> 新密钥：
						</td>
						<td width="81%" bgcolor="#FFFFFF">
						    <script type="text/javascript">pgeditor1.generate()</script>
							<input type="hidden" id="newCryptoKey" name="newCryptoKey" alt="新密钥"
								maxlength="32" size="25" class="inputStyle" />
							<span class="font_gray"> (6-20个字符)</span>
						</td>
					</tr>
					<!--重复新密钥-->
					<tr>
						<td height="30" align="right">
							<span class="orang12b">* </span> 重复新密钥：
						</td>
						<td bgcolor="#FFFFFF">
						    <script type="text/javascript">pgeditor2.generate()</script>
							<input type="hidden" id="reCryptoKey" name="reCryptoKey" alt="重复新密钥"
								maxlength="32" size="25" class="inputStyle" />
							<span class="font_gray"> (6-20个字符)</span>
						</td>
					</tr>

					<tr>
						<td height="55" align="right">
							&nbsp;
						</td>
						<td height="50" bgcolor="#FFFFFF">
							<input type="button" name="sure" value="确 定" class="button_style"
								onclick="submitProcess();" />
							<input type="button" name="return" value="返 回"
								class="button_style"
								onclick="loading('<%=path%>/route.do?modual=space$account&showTab=3');" />
						</td>
					</tr>
					</form>
				</table>
			</div>
		</div>
	</div>
</div>
